<?$count = count($this->usefuls);?>

<? foreach ($this->usefuls as $useful) :?>
    <?/** @var $useful Application_Model_Useful */?>
    <div class="useful" data-id="<?= $useful->getId(); ?>">
        <h3>
            <?if ($count > 1):?>
                <a class="info-text" href="/useful/<?= $useful->getId(); ?>"><?= $useful->getUsefulTitle(); ?></a>
            <? else: ?>
                <span class="info-text" href="/useful/<?= $useful->getId(); ?>"><?= $useful->getUsefulTitle(); ?></span>
            <? endif; ?>
        </h3>
        <div class="description" >
            <?= $useful->getUsefulDesc(); ?>'
        </div>
    </div>
<? endforeach; ?>
<?if (!$this->isOneUseful):?>
<script type="text/javascript">
    $(function () {
        var useful = $('.useful');

        $.each(useful, function (i) {
            var d = $(this).find('.description');

            if (d.height() > 200) {
                d.addClass('short');
                $(this).append('<div class="useful-short-toggle">' +
                    '<a href="/useful/' + $(this).data('id') + '">Читать далее</a>' +
                    '</div>');
            }
        });
    });
</script>
<?endif;?>